#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int cmp(char *a,char *b){
	//若大整数a大于b，返回1；
	//若a小于b，返回-1；
	// 若a与b相等，返回0
	int length1 = strlen(a);
	int length2 = strlen(b);
	if (length1>length2)
	{
		return 1;
	}
	else if (length1<length2)
	{
		return -1;
	}
	else{
		for (int i = 0; i < length1; i++)
		{
			if (*(a + i) < *(b + i)){
				return -1;
			}
			else if (*(a + i) > *(b + i))
			{
				return 1;
			}
		}
		return 0;
	}
}
 
int main(){
	char *p[3],temp[100];
	for (int i = 0; i < 3; i++)
	{
		p[i] = (char*)malloc(sizeof(char)*100);
		scanf("%s",p[i]);
	}
	for (int i = 0; i < 3; i++)
	{
		for (int j = i + 1; j < 3; j++){
			if (cmp(p[i],p[j])>0)
			{
				strcpy(temp,p[i]);
				strcpy(p[i],p[j]);
				strcpy(p[j],temp);
			}
		}
	}
	for (int i = 0; i < 3; i++)
	{
		puts(p[i]);
	}
}